home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / QUI / UTI / Premier Plug-In Kit 1.0.cpt / Premier Plug-In Kit 1.0 / MPW Examples / .c / Backwards [Audio].c next >
Text File  |  1992-03-04  |  1KB  |  41 lines

  1. //———————————————————————————————————————————————
  2. //
  3. //    ©1991 Adobe Systems Inc.
  4. //    written by Randy Ubillos
  5. //
  6. //———————————————————————————————————————————————
  7.  
  8. // Load in your Mac headers here
  9. #pragma load "headers.d"
  10.  
  11. #include "Interface-Filter.h"
  12.  
  13. //———————————————————————————————————————————————
  14. // Perform the effect
  15.  
  16. pascal short xFilter(short selector, AudioFilter theData)
  17. {
  18.     short                result = 0;
  19.     unsigned char        *dest,*buff;
  20.     long                count,i,sample;
  21.  
  22.     switch (selector) {
  23.         case fsExecute:
  24.             dest = (*theData)->destination;                                            // destination buffer
  25.             count = (*theData)->samplecount;
  26.             sample = (*theData)->totalsamples - count - (*theData)->samplenum;        // calculate new sample
  27.             if ((*theData)->callBack) {                                                // can we call back?
  28.                 if (buff = NewPtr(count)) {                                            // we need a buffer
  29.                     if (!((*theData)->callBack)(sample,count,buff,(*theData)->privateData)) {  // get the data
  30.                         for (i=0; i<count; i++) dest[i] = buff[count-i-1];            // flip it around
  31.                     }
  32.                     DisposPtr(buff);                                                // kill the buffer
  33.                 }
  34.             }
  35.             else BlockMove((*theData)->source,dest,count);                            // otherwise, just copy
  36.             break;
  37.     }
  38.     return(result);
  39. }
  40.  
  41.